package com.xingfly.util;

/**
 * Created by SuperS on 01/03/2017.
 *
 * @author SuperS
 */
public class PageUtil {
    public static Integer parsePage(String pageStr) {
        Integer page = null;
        if (pageStr != null) {
            page = Integer.parseInt(pageStr);
            if (page <= 0) {
                page = 1;
            }
        } else {
            page = 1;
        }
        return page;
    }

    public static Integer parseSize(String sizeStr) {
        Integer size = null;
        if (sizeStr != null) {
            size = Integer.parseInt(sizeStr);
            if (size <= 0) {
                size = WebConstant.DEFAULT_PAGE_SIZE;
            }
        } else {
            size = WebConstant.DEFAULT_PAGE_SIZE;
        }
        return size;
    }
}
